package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.dao.MemberMapper;
import com.itheima.dao.OrderMapper;
import com.itheima.service.ChartReportService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: LIHAO
 * @Description:
 * @Date: Create in 10:04 2020/2/12
 */
@Service
public class ChartReportServiceImpl implements ChartReportService {
   @Autowired
  private  MemberMapper memberMapper;
  @Autowired
   private OrderMapper orderMapper;
    /**
     * 会员数量分析
     * @param months
     * @return
     */
    @Override
    public List<Integer> getMemberReport(ArrayList<String> months) {
        ArrayList<Integer> memberCount = new ArrayList<>();
        for (String month1 : months) {
            String month= month1+"-31";
            Integer count=  memberMapper.getMemberReport(month);
            memberCount.add(count);
        }
        return memberCount;
    }

    /**
     * 套餐占比
     * @return
     */
    @Override
    public List<Map> chartReportInterface() {
        List<Map> maps=  orderMapper.chartReportInterface();

        return maps;
    }

    /**
     * 获取会员性别
     * @return
     */
    @Override
    public  List<Map> getSex() {

       List<Map> map=memberMapper.getSex();

        return map;
    }

    /**
     * 获取年龄段
     * @return
     */
    @Override
    public List<Map> getAge() {

        List<Map>  ages = memberMapper.getAge();

        return ages;
    }




}
